-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Override OAuth2AuthenticationException to differentiate the errors thrown by Appsmith #35160
chore: Override OAuth2AuthenticationException to differentiate the errors thrown by Appsmith #35160
Conversation
WalkthroughThe recent changes enhance authentication error handling within the Appsmith application by introducing a custom exception class, Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (2)
- app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/CustomOidcUserServiceCEImpl.java (2 hunks)
- app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithOAuth2AuthenticationException.java (1 hunks)
Additional comments not posted (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/exceptions/AppsmithOAuth2AuthenticationException.java (1)
1-29
: Well-structured class definition.The
AppsmithOAuth2AuthenticationException
class is well-structured and correctly extendsOAuth2AuthenticationException
. The use of Lombok's@Getter
annotation simplifies the code by automatically generating getter methods for theerror
field. The constructors are properly defined to initialize the error object.app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/CustomOidcUserServiceCEImpl.java (1)
80-82
: Good use of custom exception for better error differentiation.The change to use
AppsmithOAuth2AuthenticationException
enhances error differentiation by clearly distinguishing between Appsmith-specific exceptions and OAuth2 exceptions. The added comments provide clarity on the purpose of this change, which is a good practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/CustomOAuth2UserServiceCEImpl.java (2 hunks)
Additional comments not posted (4)
app/server/appsmith-server/src/main/java/com/appsmith/server/authentication/handlers/ce/CustomOAuth2UserServiceCEImpl.java (4)
6-7
: Good import!The import of
AppsmithOAuth2AuthenticationException
is necessary for the enhanced error handling.
15-15
: Good import!The import of
OAuth2Error
is necessary for creating detailed error messages.
71-72
: Excellent error handling!The
.onErrorMap
clause is a great addition for transformingAppsmithException
instances intoAppsmithOAuth2AuthenticationException
instances.
73-77
: Well-implemented error transformation!The logic for transforming
AppsmithException
intoAppsmithOAuth2AuthenticationException
is well-implemented, enhancing error differentiation and clarity.
…rors thrown by Appsmith (#35160) ## Description > Extend OAuth2AuthenticationException so that we can differentiate between AppsmithException and exceptions thrown by Spring Library. > There is not going to be any change to the Authentication flows here, as the we are just inheriting the OAuth2AuthenticationException. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10092949232> > Commit: bc2f204 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10092949232&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 25 Jul 2024 13:13:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new custom exception for improved handling of OAuth 2.0 authentication errors, enhancing the clarity and robustness of the authentication process. - **Bug Fixes** - Enhanced error categorization in the authentication process by refining the error handling logic, allowing for better management of exceptions related to OAuth 2.0. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nilesh Sarupriya <[email protected]>
…rors thrown by Appsmith (appsmithorg#35160) ## Description > Extend OAuth2AuthenticationException so that we can differentiate between AppsmithException and exceptions thrown by Spring Library. > There is not going to be any change to the Authentication flows here, as the we are just inheriting the OAuth2AuthenticationException. Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10092949232> > Commit: bc2f204 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10092949232&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 25 Jul 2024 13:13:00 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new custom exception for improved handling of OAuth 2.0 authentication errors, enhancing the clarity and robustness of the authentication process. - **Bug Fixes** - Enhanced error categorization in the authentication process by refining the error handling logic, allowing for better management of exceptions related to OAuth 2.0. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Nilesh Sarupriya <[email protected]>
Description
Fixes #35154
Fixes #35157
Fixes #35155
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10092949232
Commit: bc2f204
Cypress dashboard.
Tags:
@tag.All
Spec:
Thu, 25 Jul 2024 13:13:00 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes